import time

def send_message(MQ_send, connection_send, message_result):
    '''
    :param MQ_send: 发送队列的对象
    :param connection_send: 发送的连接
    :param task_id: 任务id
    :param task_type: 任务type
    :param time_sleep: 休眠时间
    :return:
    '''
    # send_MQ = MQ(name_que)
    # send_connection = send_MQ.create_MQ(auth_name, auth_pwd, address_dateway, address_port, virtual_host)
    message_send_heart = message_result
    MQ_send.send_Message_MQ(MQ_send.create_MQ(), message_send_heart)

###################    mhr     for test
    print("send message is : "+message_send_heart)
    # connection_send.close()


def send_heart(MQ_send, connection_send, message_result, time_sleep):
    # print("1111111111")
    '''

    :param MQ_send: 发送队列的对象
    :param connection_send: 发送的连接
    :param task_id: 任务id
    :param task_type: 任务type
    :param time_sleep: 休眠时间
    :return:
    '''
    # send_MQ = MQ(name_que)
    # send_connection = send_MQ.create_MQ(auth_name, auth_pwd, address_dateway, address_port, virtual_host)
    message_send_heart = message_result
    heart_connection = MQ_send.create_MQ()
    while True:
        print(type(message_send_heart))

        MQ_send.send_heart_Message_MQ(heart_connection, message_send_heart)
        time.sleep(time_sleep)
